import { createApp } from 'vue'
// vantUI
import {
  DatePicker,
  NavBar,
  Empty,
  Cascader,
  Uploader,
  RadioGroup,
  Radio,
  Popup,
  Overlay,
  Loading,
  Dialog,
  Picker,
  Form,
  Field,
  CellGroup,
  Cell,
  Icon,
  Card,
  Checkbox,
  CheckboxGroup,
  Button,
  PullRefresh,
  List,
  Search,
  Tab,
  Tabs,
  Toast,
  Skeleton,
  SkeletonTitle,
  SkeletonImage,
  SkeletonAvatar,
  SkeletonParagraph,
  Swipe, 
  SwipeItem,
  PickerGroup,
  TimePicker 
} from 'vant'
import 'vant/lib/index.css'; // 全局引入样式

// varletUI
import Varlet from '@varlet/ui'
import '@varlet/ui/es/style'
// 引入封装的router
import router from '@/router/index'
import { store } from '@/pinia'

import App from './App.vue'
// 动态设置rem值
import 'amfe-flexible'
import './assets/font/font.css'
// 引入自定义组件
import components from '@/components/index'
const app = createApp(App)

// VConsole插件
// import VConsole from 'vconsole';
// const vConsole = new VConsole({ theme: 'dark' });

// 挂载全局方法-路由跳转使用
app.config.globalProperties.goBack = (num)=>{
  router.isBack = true;
  if(num == -1) {
    router.go(num);
  } else {
    router.push(num);
  }
}


app
  .use(Varlet)
  .use(DatePicker)
  .use(Popup)
  .use(Overlay)
  .use(Loading)
  .use(Dialog)
  .use(Toast)
  .use(Form)
  .use(Field)
  .use(CellGroup)
  .use(Cell)
  .use(Icon)
  .use(Card)
  .use(Button)
  .use(PullRefresh)
  .use(List)
  .use(Tab)
  .use(Tabs)
  .use(Checkbox)
  .use(CheckboxGroup)
  .use(Skeleton)
  .use(SkeletonTitle)
  .use(SkeletonImage)
  .use(SkeletonAvatar)
  .use(SkeletonParagraph)
  .use(Picker)
  .use(RadioGroup)
  .use(Radio)
  .use(Uploader)
  .use(Cascader)
  .use(Empty)
  .use(Search)
  .use(NavBar)
  .use(Swipe)
  .use(SwipeItem)
  .use(PickerGroup)
  .use(TimePicker)

app.use(store)
app.use(components)
app.use(router)
app.mount('#app')

export default app
